<template>
  <div class="mine">
      <div class="com-top-nav">
        <van-nav-bar
        title="我的"
      />
      </div>
      <div>
          <div top-person-module>
            <div left>
                <h3>{{mine.nickname}}</h3>
                <span>这个人超级酷，一点签名都不写~</span>
            </div>
            <div right><img :src="mine.headimgurl" alt=""></div>
          </div>
      </div>
      <div com-list-cell>
          <ul>
            <router-link class="item" tag="li" :to="{name:'myInfo'}">
              <img src="/static/img/my.svg" alt="">
              <p>
                <span>管理我的信息</span>
                <span></span>
              </p>
            </router-link>
            <router-link class="item" tag="li" :to="{name:'authentication'}">
              <img src="/static/img/certification.svg" alt="">
              <p>
                <span>个人认证</span>
                <span></span>
              </p>
            </router-link>
             <router-link class="item" tag="li" :to="{name:'myWallet'}">
              <img class="img" src="/static/img/wallet.svg" alt="">
              <p>
                <span>我的钱包</span>
                <span>
                  <!-- <img src="/static/img/right.svg" alt=""> -->
                </span>
              </p>
            </router-link>
             <router-link class="item" tag="li" :to="{name:'feedback'}">
              <img src="/static/img/help.svg" alt="">
              <p>
                <span>帮助与反馈</span>
                <span></span>
              </p>
            </router-link>
             <router-link class="item" tag="li" :to="{name:'myBill'}">
              <img src="/static/img/bill.svg" alt="">
              <p>
                <span>我的账单</span>
                <span></span>
              </p>
            </router-link>
            <li @click="changeId" class="item">
                <img src="/static/img/change.svg" alt="">
              <p>
                <span>身份切换</span>
                <span></span>
              </p>
            </li>
            <li @click="cleanHandle" class="item">
              <img src="/static/img/clean2.svg" alt="">
              <p>
                <span>清理缓存</span>
                <span></span>
              </p>
            </li>
           <!--   <router-link class="item" tag="li" :to="{name:'enterprise'}">
              <img src="/static/img/change.svg" alt="">
              <p>
                <span>身份切换</span>
                <span></span>
              </p>
            </router-link> -->
              <router-link class="item" tag="li" :to="{name:'historyRelease'}">
              <img src="/static/img/history.svg" alt="">
              <p>
                <span>历史发布</span>
                <span></span>
              </p>
            </router-link>
          </ul>
      </div>
      <bottom-person-nav/>
  </div>
</template>
<script>
import bottomNav from '../components/person-nav.vue'
import Vue from 'vue'
import { NavBar } from 'vant';

Vue.use(NavBar);
export default {
  data(){
    return {
        mine:{}
    }
  },
  methods:{
    changeId(){
      this.axios.get('/api/switch',{params:{uid:JSON.parse(sessionStorage.getItem('user')).uid}}).then(r=>{
        console.log('====')
        console.log(r)
        sessionStorage.setItem("identity",r.data.data.identity)
        this.$router.push({name:'enterprise'})
      })
    },
    init(){
      this.axios.get('/api/mine',{params:{uid:JSON.parse(sessionStorage.getItem("user")).uid}}).then(r=>{
        console.log('=============')
        console.log(r.data.data)
        this.mine = r.data.data
      })
    },
    cleanHandle(){
      sessionStorage.clear();
      sessionStorage.clear();
      this.$router.push({path:'/'})
    },
  },

  created(){
    this.init()
  },
    components:{
        'bottom-person-nav':bottomNav
    }
}
</script>

<style lang="less" scope>
@import url('../../static/style/bottom-person-nav.less');
@import url('../../static/style/mine.less');
.demo-color-btn {
  margin: 8px;
}
</style>
